<script type="text/javascript" src="<?php echo BASE_URL;?>js/admin/site/admin/function.js"></script>
<?php global $has_permit; ?>
<div class="std_header auto_height">
    <div class="left">
        <strong>Cấu hình hệ thống</strong>
    </div>
</div>
<div class="db_left bl">
    <?php $this->load->view('site/admin/side_block'); ?>
</div>
<div class="db_right bl">
    <?php if ($has_permit) :?>
    <div id="admin_management">
        <div id="tab_store" class="tab_container">
            <ul>
                <li id="active_tab_edit"><a href="#tab_edit"><span>Cấu hình Website</span></a></li>
            </ul>
            <div id="tab_edit">
                <form id="frm_admin_edit" enctype="multipart/form-data" method="POST" action="<?php echo $save_action; ?>">
                    <?php $this->load->view('site/admin/message'); ?>
                    <div class="clearfix auto_height">
                        <?php $buttons = $this->load->view('admin/site/admin/config/buttons', null, true); echo $buttons; ?>
                    </div>
                    <div class="form_block">
                        <div class="block_header">
                            Thông tin căn bản
                        </div>
                        <div class="block_content">
                            <table cellpadding="0px" cellspacing="0px">
                                <tr>
                                    <td class="frm_label">Logo đại diện(*)</td>
                                    <td class="frm_field">
                                        <?php $logo = get_field($config, 'logo'); ?>
                                        <?php if (!empty($logo)) :?>
                                        <a target="_blank" href="<?php echo render_src($logo); ?>"><img src="<?php echo render_src($logo); ?>" width="40px" style="vertical-align: middle; border: 2px solid #bbb" /></a>
                                        <?php endif; ?>
                                        <input type="file" name="data_logo" />
                                        &nbsp;
                                        <input onclick="return admin_site_admin.toggle_display_wp_img_path(this.checked)" style="top: 2px; position: relative" type="checkbox" name="set_logo_url" id="set_logo_url" value="1" />
                                        <label for="set_logo_url">Chọn đường dẫn ảnh</label>
                                        <div class="clearfix mt_10" id="wp_img_path" style="display: none">
                                            <input name="logo_path" type="text" class="std_input" value="<?php echo $logo; ?>" />
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Chiều dài logo(*)</td>
                                    <td class="frm_field">
                                        <input type="text" class="std_input required" name="data[logo_width]" value="<?php echo get_field($config, 'logo_width'); ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Chiều rộng logo(*)</td>
                                    <td class="frm_field">
                                        <input type="text" class="std_input required" name="data[logo_height]" value="<?php echo get_field($config, 'logo_height'); ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Tên trang(*)</td>
                                    <td class="frm_field">
                                        <input type="text" class="std_input required" name="data[site_name]" value="<?php echo get_field($config, 'site_name'); ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Tiêu đề(*)</td>
                                    <td class="frm_field">
                                        <input type="text" class="std_input required" name="data[site_title]" value="<?php echo get_field($config, 'site_title'); ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Địa chỉ email(*)</td>
                                    <td class="frm_field">
                                        <input type="text" class="std_input required" name="data[site_email]" value="<?php echo get_field($config, 'site_email'); ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Điện thoại(*)</td>
                                    <td class="frm_field">
                                        <input type="text" class="std_input required" name="data[site_phone]" value="<?php echo get_field($config, 'site_phone'); ?>" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Giới thiệu</td>
                                    <td class="frm_field">
                                        <textarea name="data[about]"><?php echo get_field($config, 'about'); ?></textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Online</td>
                                    <td class="frm_field">
                                        <select name="data[online]" id="site_online">
                                            <option value="-1">Chọn chế độ</option>
                                            <option value="1" <?php if (get_field($config, 'online') == 1) :?> selected="selected" <?php endif; ?>>Online</option>
                                            <option value="0" <?php if (get_field($config, 'online') == 0) :?> selected="selected" <?php endif; ?>>Offline</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="frm_label">Tin nhắn khi Offline</td>
                                    <td class="frm_field">
                                        <textarea name="data[offline_message]"><?php echo get_field($config, 'offline_message'); ?></textarea>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="clearfix auto_height mb_10">
                        <?php echo $buttons; ?>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <?php else :?>
    <?php $this->load->view('layouts/restricted'); ?>
    <?php endif; ?>
</div>
<div class="clearfix"></div>